package com.kly.smartbi.model.enums;

import lombok.Getter;

/**
 * @author admin
 * @date 2025/4/1
 */
@Getter
public enum ChartStatusEnum {
    /**
     * 任务状态枚举
     */
    WAITING(0, "等待中"),
    PROCESSING(1, "进行中"),
    SUCCESS(2, "成功"),
    FAILED(3, "失败");

    private final int code;
    private final String message;

    ChartStatusEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 根据状态码获取枚举类型
     */
    public static ChartStatusEnum getEnumByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ChartStatusEnum value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }

}